import { registerOnHeartBeat } from '$lib/content/heart';
import { Types, defineComponent } from '$lib/ecs';

/*
 * Hunger/satiation. No inventory for food.
 * Each heartbeat remove tick from satiation
 */
export const Hunger = defineComponent('Hunger', {
  satiation: Types.i32,
  tick: Types.i32,
});

registerOnHeartBeat(Hunger, (world, e) => {
  Hunger.satiation[e] -= Hunger.tick[e];
});
